package com.hubu.thread.threadpool;
import java.util.UUID;
public class Main {
    public static void main(String[] args) {
        ThreadPool threadPool=new ThreadPool(5,20,2000000,new DefaultThreadFactory(),(task)->{
            throw  new RuntimeException("任务队列已经满了，拒绝接收任务");
        });
        Thread t1=new Thread(()->{
            threadPool.execute(()->{
                while(true){
                    Runnable task=()->{
                        try {
                            Thread.sleep(5);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        String uuid= UUID.randomUUID().toString();

                        try {
                            Thread.sleep(10);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        System.out.println(uuid);
                    };
                    threadPool.execute(task);
                }
            });
        });
        t1.start();
    }
}
